#!/usr/bin/env python
# encoding: utf-8
from t import T
import re
import urllib2,requests,urllib2,json,urlparse
requests.packages.urllib3.disable_warnings()

import subprocess


class P(T):
    def __init__(self):
        T.__init__(self)
    def verify(self,head='',context='',ip='',port='',productname={},keywords='',hackinfo=''):
        timeout=5
        if int(port) == 443:
            protocal = "https"
        else:
            protocal = "http"
        target_url = protocal + "://"+ip+":"+port+'/'


        result = {}
        result['result']=False

        try:

            myout =  subprocess.check_output(['curl', '--connect-timeout', '2', '--max-time', '2', '-s','-I', '-X', 'PROPFIND',target_url ])
            if "HTTP/1.1 411 Length Required" in myout:

                result['result']=True
                result['VerifyInfo'] = {}
                result['VerifyInfo']['type']='command execute Vulnerability'
                result['VerifyInfo']['URL'] =target_url
                result['VerifyInfo']['payload']= 'iis_cve-2017-7269 Vulnerability'
                result['VerifyInfo']['level']= 'hole'
                result['VerifyInfo']['result'] =r.content
        except Exception,e:
            #print '[-]error',
            print e.text
            #pass
            #print traceback.print_exc()
        finally:

            return result



if __name__ == '__main__':
    print P().verify(ip='122.224.58.215',port='80')

